<template>
	<view class="content" v-if="show">
		<!-- 头部导航 -->
		<view class="w-750 w-bj-cont" style="position: fixed; top: 0; left: 0;">
			<view class="h-100 w-row-justify-between-align">
				<view class="wh-80 w-row-center"></view>
				<view class="w-250 h-100 w-row-center w-wz-conts font-36">消息中心</view>
				<view class="wh-80 w-row-center"></view>
			</view>
		</view>
		<view class="bwh-100"></view>
		<!-- 头部导航结束 -->

		<!-- 内容区域 -->
		<!-- <view class="wh-200 w-bj-red" v-for="i in 20"></view> -->
		<view class="w-720 h-150 w-bj-cont w-bor-12 w-row-align w-row-align m-top-20" v-for="item in tableData" @click="indexRoute(item)">
			<view class="wh-150 w-row-center">
				<image class="wh-90" src="../../static/gane/tz.png"></image>
			</view>
			<view class="w-500 h-100 w-column-justify-around">
				<view class="w-row-justify-between-align"><text class="w-wz-conts font-32">[<text class="p-4">消息通知</text>]</text> <text class="w-wz-conts font-26 ">{{item.create_time}}</text></view>
				<text class="w-wz-black8 font-28 w-text-overflow">{{item.title}}</text>
			</view>
			<view class="w-60 h-100 w-row-center">
				<view class="wh-10 w-bj-red w-bor-12" v-if="item.sta == 1"></view>
			</view>
		</view>

	</view>
</template>

<script>
	import $H from '@/pages/common/request.js'
	export default {
		data() {
			return {
				UserInfo: {},
				show: false,
				tableData: [],
			}
		},

		onLoad() {
			
			this.UserInfo = uni.getStorageSync('UserInfo');
			if (this.UserInfo.uid && this.UserInfo.token) {
				this.getData()
			} else {
				return uni.reLaunch({
					url: '/pages/index/index'
				});
			}
		},

		methods: {

			getData() {
				$H.post('/app_user_news').then((res) => {

					if (res.code == 200) {
						this.show = true
						this.tableData = res.data
					} else {
						return uni.showToast({
							title: res.msg,
							duration: 1000,
							icon: 'none'
						});
					}
				})
			},

			indexRoute(item) {
				uni.navigateTo({
					url:`/pages/news/newsdetails?item=${JSON.stringify(item)}`
				});
			},

		}
	}
</script>

<style>
page{
	background-color: #363636;
}
</style>




